# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=isme
pkgver=0.12
pkgrel=11
groups=('blackarch' 'blackarch-voip' 'blackarch-recon' 'blackarch-scanner')
pkgdesc='Scans a VOIP environment, adapts to enterprise VOIP, and exploits the possibilities of being connected directly to an IP Phone VLAN.'
arch=('x86_64' 'aarch64')
url='https://packetstormsecurity.com/files/123534/IP-Phone-Scanning-Made-Easy-0.12.html'
license=('GPL3')
depends=('perl' 'perl-libwww' 'perl-html-parser' 'perl-net-ping' 'perl-net-tftp'
        'perl-net-netmask' 'perl-net-subnet' 'perl-http-date' 'perl-net-rawip'
        'perl-net-libdnet' 'perl-crypt-ssleay' 'perl-lwp-protocol-https'
        'perl-mozilla-ca' 'perl-http-message' 'perl-net-ssh-perl' 'perl-tk'
        'perl-net-dhcp')
makedepends=('unzip')
source=("https://dl.packetstormsecurity.net/UNIX/scanners/${pkgname}_v${pkgver}.zip")
sha512sums=('776024eb51ade86336d1b4d46ca2cafc77418198bff85f426a2ceef6a98f6bebe934f7eeb9afc12d2aa3b5f3ccc3385e4478cbfde10537ab61b262b095f62490')

package() {
  cd "${pkgname}_v${pkgver}"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"
  install -dm 755 "$pkgdir/usr/share/doc/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" \
    Doc/"ISME Documentation v0.12.pdf"
  install -Dm 644 Doc/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm -rf Doc

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec perl $pkgname.pl "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

